<!--
 * @Author: Lakeiedward
 * @Date: 2022-02-26 19:48:02
 * @LastEditTime: 2022-02-27 02:04:08
 * @FilePath: \demo2\src\components\two.vue
-->
<template>
  <div>
    <el-table :data="reception" style="width: 100%" max-height="250">
      <el-table-column fixed prop="time" label="日期" width="150">
      </el-table-column>
      <el-table-column prop="name" label="消费事项" width="100">
      </el-table-column>
      <el-table-column prop="value" label="消费金额" width="100">
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="100">
        <template slot-scope="scope">
          <el-button
            @click.native.prevent="deleteRow(scope.$index, reception)"
            type="text"
            size="small"
          >
            移除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  props: ["reception"],
  data() {
    return {};
  },
  methods: {
    deleteRow(index, rows) {
      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          rows.splice(index, 1);
          const yy = JSON.stringify(this.reception);
          localStorage.setItem("aaa", yy);
          this.$root.$emit('www',index)
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
  mounted() {},
};
</script>
<style scoped lang='scss'></style>